@echo on
set CODE_BASE=C:\workplace\belf
echo %CODE_BASE%

echo begin to package belf-migrate
cd %CODE_BASE%\belf-migrate
git pull
call gradle jar -x test
@rem 检查构建是否成功，如果失败，退出脚本
if %ERRORLEVEL% neq 0 (
    echo build jar error. Exiting...
    exit /b %ERRORLEVEL%
)

@echo copy all built jar to libs
@echo :core:copyLibs 
call gradle :core:copyLibs 

@echo :api:copyLibs 
call gradle :api:copyLibs

@echo :plugins:mysql:copyLibs 
call gradle :plugins:mysql:copyLibs

@echo :plugins:oracle:copyLibs 
call gradle :plugins:oracle:copyLibs

@echo :plugins:dameng:copyLibs
call gradle :plugins:dameng:copyLibs

@echo :plugins:kingbase:copyLibs
call gradle :plugins:kingbase:copyLibs

@echo :engine:copyLibs 
call gradle :engine:copyLibs

cd  %CODE_BASE%\belf-base
git pull

cd  %CODE_BASE%\belf-node
git pull

cd %CODE_BASE%\belf-console
git pull

@echo build console bootjar
@echo %CODE_BASE%\belf-console
call gradle bootjar

@echo pull console web code
cd %CODE_BASE%\belf-consoleWeb
git pull

cd %CODE_BASE%

echo All projects built successfully.
pause
